Repository navigation
Rest shape measure - #229
Conversation
…ipc-toolkit into rest_shape_measure
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #229 +/- ##
==========================================
+ Coverage 96.85% 96.86% +0.01%
==========================================
Files 225 227 +2
Lines 22855 23035 +180
Branches 1587 1620 +33
==========================================
+ Hits 22136 22313 +177
- Misses 719 722 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an option to use rest-shape (non-differentiated) quadrature measures for smooth-contact primitives to avoid spurious gradients from integrating over deformed collision mesh parameters.
Changes:
- Introduces
use_rest_shape_measureinSmoothContactParametersto toggle rest-shape quadrature weights. - Updates Point2/Point3/Edge2/Edge3 to use rest-shape length/area weights and to drop derivative contributions from the measure when enabled.
- Refactors Face primitive evaluation to return rest-shape area (and zero derivatives) when enabled.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ipc/smooth_contact/common.hpp | Adds use_rest_shape_measure toggle to parameters. |
| src/ipc/smooth_contact/primitives/point3.hpp | Stores a cached rest-shape quadrature weight for Point3. |
| src/ipc/smooth_contact/primitives/point3.cpp | Computes/uses rest-shape Point3 weight; removes measure derivatives when enabled. |
| src/ipc/smooth_contact/primitives/point2.hpp | Stores a cached rest-shape length measure for Point2. |
| src/ipc/smooth_contact/primitives/point2.cpp | Passes a “measure” into point2 terms and switches between rest/deformed measures. |
| src/ipc/smooth_contact/primitives/face.hpp | Changes Face evaluation API to instance methods and stores rest area. |
| src/ipc/smooth_contact/primitives/face.cpp | Computes rest area; returns constant measure / zero derivatives when enabled. |
| src/ipc/smooth_contact/primitives/edge3.hpp | Stores cached rest-shape squared edge length. |
| src/ipc/smooth_contact/primitives/edge3.cpp | Uses rest/deformed squared-length weight and drops its derivatives when enabled. |
| src/ipc/smooth_contact/primitives/edge2.hpp | Stores cached rest-shape edge length. |
| src/ipc/smooth_contact/primitives/edge2.cpp | Returns rest length / zero derivatives when enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Always compute and default-initialize the rest-shape measures - Factor the Point2 measure selection into shared helpers - Drop unused `d` parameter names in Face
|
Hi @udaykusupati, is this fix still relevant after the ESP changes? I updated it with main and resolved the Copilot comments. I can merge it after you give the go-ahead. |
|
This PR was merged by accident. I pushed the branch to The changes will stay on |
Description
For all the primitives, using quadrature on the rest shape instead of on the autodiff/differentiable parameters of the collision mesh. This feature is enabled by adding a use_rest_shape_measure parameter in SmoothParams
Fixes # (issue)
Type of change
How Has This Been Tested?
This was necessary for a 2D GCP case where spurious gradients appear when integrating on the deformation coordinates.
However, no explicit testing was done, except gradient visualization
Checklist